package com.czd.support.util;

import org.apache.commons.lang3.StringUtils;

/**
 * Created with IntelliJ IDEA.
 * Author: Jerry.hu
 * Create: Jerry.hu (14-7-28 9:55)
 * Description:
 * To change this template use File | Settings | File Templates.
 */
public class StringOperatorUtils {

	public static String interceptioMark(String str,String startMark,String endMark){
		if(StringUtils.isBlank(str)){
			return null;
		}
		int start = str.lastIndexOf(startMark);
		int end = str.lastIndexOf(endMark);
		if(start > 0 && end > 0){
			return str.substring(start+1,end);
		}
		return str;
	}


	public static String interceptioMark(String str,String startMark){
		if(StringUtils.isBlank(str)){
			return null;
		}
		int start = str.lastIndexOf(startMark);
		if(start > 0){
			return str.substring(0,start);
		}
		return str;
	}

	public static void main(String[] args) {
		System.out.println(interceptioMark("你啊好哦阿萨德发(测试截取)", "(", ")"));
		System.out.println(interceptioMark("你啊好哦阿萨德发(测试截取)", "("));
	}
}
